package com.ebiz.mockup.core
{
	import com.ebiz.mockup.MockupCore;
	import com.ebiz.mockup.MockupCoreMediator;
	import com.ebiz.mockup.commands.StartupMacroCommand;
	
	import org.puremvc.as3.multicore.patterns.facade.Facade;

	/**
	 * 
	 * @author Jack
	 * 
	 */	
	public class Core extends org.puremvc.as3.multicore.patterns.facade.Facade
	{
		private static var _instance:com.ebiz.mockup.core.Core;
		
		public static function get instance():Core{
			if(_instance==null){
				_instance = new Core();
			}
			return _instance;
		}
		
		/**
		 * is always mouseDown since select a component from list,
		 * if yes, add a component directly when first mouseUp in Board 
		 */		
		public var draggingAlwaysMouseDown:Boolean = false;
		
		public var dragging:Object;
		
		public function Core()
		{
			super("ebiz_mockup_2010");
		}
		
		public function startup($view:MockupCore):void{
			//register mediators
			this.registerMediator(new MockupCoreMediator($view));
			//run startup macro command
			this.registerCommand(StartupMacroCommand.NAME,StartupMacroCommand);
			this.sendNotification(StartupMacroCommand.NAME,$view);
			this.removeCommand(StartupMacroCommand.NAME);
		}
		
		//===================
		//tools functions
		//===================
		public function warm($type:String):void{
			Warm.instance.show($type);
		}
	}
}